﻿using System;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;

using LTJ.Entity;
using LTJ.Common;
using LTJ.Config;
using LTJ.FrameWork;

namespace LTJ.WebPage.SystemManage.route
{
    /// <summary>
    /// 整柜航线授权
    /// </summary>
    public partial class fclrouteset : AdminPage
    {
        protected int corpid = SASRequest.GetInt("id", 0);

        protected void editroute_Click(object sender, EventArgs e)
        {
            RouteInfo rinfo = new RouteInfo();
            rinfo.cid = corpid;
            rinfo.bcode = SASRequest.GetString("ajaxcarrierlist_value");
            rinfo.tcode = SASRequest.GetString("ajaxroutelinedatalist_value");
            rinfo.creater = username;

            if (rinfo.cid == 0 || rinfo.bcode == "" || rinfo.tcode == "")
            {
                base.RegisterStartupScript("PAGETEMPLATE", "请完整选择航线授权信息！");
                return;
            }
            if (Routes.CreateRoute(rinfo) == -1)
            {
                base.RegisterStartupScript("PAGETEMPLATE", "该航线授权已经存在，不能重复授权！");
                return;
            }

            base.RegisterStartupScript("PAGE", "parent.document.getElementById('reclick').click();parent.Lightview.hide();");
        }

        #region Web 窗体设计器生成的代码

        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            editroute.Click += new EventHandler(editroute_Click);
        }

        #endregion
    }
}